package com.cdtu.room.service.impl;

import java.util.List;

import com.cdtu.room.dto.FeedbackDto;
import com.cdtu.room.vo.FeedbackVo;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cdtu.room.mapper.FeedbackMapper;
import com.cdtu.room.domain.Feedback;
import com.cdtu.room.service.IFeedbackService;

/**
 * 评价与反馈Service业务层处理
 * 
 * @author hcc
 * @date 2024-02-27
 */
@Service
public class FeedbackServiceImpl implements IFeedbackService 
{
    @Autowired
    private FeedbackMapper feedbackMapper;

    /**
     * 查询评价与反馈
     * 
     * @param feedbackId 评价与反馈主键
     * @return 评价与反馈
     */
    @Override
    public Feedback selectFeedbackByFeedbackId(Long feedbackId)
    {
        return feedbackMapper.selectFeedbackByFeedbackId(feedbackId);
    }

    /**
     * 查询评价与反馈列表
     * 
     * @param feedback 评价与反馈
     * @return 评价与反馈
     */
    @Override
    public List<Feedback> selectFeedbackList(Feedback feedback)
    {
        return feedbackMapper.selectFeedbackList(feedback);
    }

    /**
     * 新增评价与反馈
     * 
     * @param feedback 评价与反馈
     * @return 结果
     */
    @Override
    public int insertFeedback(Feedback feedback)
    {
        feedback.setFeedbackTime(DateUtils.getNowDate());
        feedback.setCreateBy(SecurityUtils.getUsername());
        feedback.setCreateTime(DateUtils.getNowDate());
        return feedbackMapper.insertFeedback(feedback);
    }

    /**
     * 修改评价与反馈
     * 
     * @param feedback 评价与反馈
     * @return 结果
     */
    @Override
    public int updateFeedback(Feedback feedback)
    {
        return feedbackMapper.updateFeedback(feedback);
    }

    /**
     * 批量删除评价与反馈
     * 
     * @param feedbackIds 需要删除的评价与反馈主键
     * @return 结果
     */
    @Override
    public int deleteFeedbackByFeedbackIds(Long[] feedbackIds)
    {
        return feedbackMapper.deleteFeedbackByFeedbackIds(feedbackIds);
    }

    /**
     * 删除评价与反馈信息
     * 
     * @param feedbackId 评价与反馈主键
     * @return 结果
     */
    @Override
    public int deleteFeedbackByFeedbackId(Long feedbackId)
    {
        return feedbackMapper.deleteFeedbackByFeedbackId(feedbackId);
    }

    /**
     * 查询评价与反馈列表
     * @param feedbackVo
     * @return
     */
    @Override
    public List<FeedbackDto> getFeedbackList(FeedbackVo feedbackVo) {
        return feedbackMapper.getFeedbackList(feedbackVo);
    }
}
